import java.util.Scanner;
public class test3 {
    public static void main(String[] args) {
        //输入
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字");
        int n = sc.nextInt();
        System.out.println("请输入一个数字");
        int m = sc.nextInt();
        boolean ret = (n == 6 || m == 6 || (n + m) % 6 ==0);

            System.out.println(ret);

    }
}
